// Decompiled on 周六 2月 22 19:31:49 CST 2025 with Zomboid Decompiler v0.1.3 using Vineflower.
package zombie.commands.serverCommands;

import zombie.commands.CommandArgs;
import zombie.commands.CommandBase;
import zombie.commands.CommandHelp;
import zombie.commands.CommandName;
import zombie.commands.RequiredRight;
import zombie.core.logger.ExceptionLogger;
import zombie.core.logger.LoggerManager;
import zombie.core.raknet.UdpConnection;
import zombie.iso.weather.ClimateManager;

@CommandName(
    name = "startstorm"
)
@CommandArgs(
    optional = "(\\d+)"
)
@CommandHelp(
    helpText = "UI_ServerOptionDesc_StartStorm"
)
@RequiredRight(
    requiredRights = 60
)
public class StartStormCommand extends CommandBase {
    public StartStormCommand(String username, String userAccessLevel, String command, UdpConnection connection) {
        super(username, userAccessLevel, command, connection);
    }

    @Override
    protected String Command() {
        float _float = 24.0F;
        if (this.getCommandArgsCount() == 1) {
            try {
                _float = Float.parseFloat(this.getCommandArg(Integer.valueOf(0)));
            } catch (Throwable throwable) {
                ExceptionLogger.logException(throwable);
                return "Invalid duration value";
            }
        }

        ClimateManager.getInstance().transmitServerStopWeather();
        ClimateManager.getInstance().transmitServerTriggerStorm(_float);
        LoggerManager.getLogger("admin").write(this.getExecutorUsername() + " started thunderstorm");
        return "Thunderstorm started";
    }
}
